<?php

/**
 * Description of setRestaurantAction
\* www.teuker.nl - mail@teuker.nl
 * 
 * @author francisc
 */

class setRestaurantAction extends sfAction {
    
    public function execute($request) {
        $restaurant_id = $request->getParameter('restaurant_id', null);
        
        if (empty($restaurant_id)) {
            $this->getUser()->setAttribute('current_restaurant_id', null);
            return sfView::NONE;
        }

        $settings = SqlEngine::getSettings(array('restaurant_id' => $restaurant_id));
        $restaurant = SqlEngine::getRestaurants(array('restaurant_id' => $restaurant_id));

        Util::set_session_info($restaurant[0], $settings, $this->getUser());

        return sfView::NONE;
    }
}
